package tt.dz.egobus.servicemanager.business.key;

import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.ArrayUtils;
import tt.dz.egobus.bean.BaseBean;
import tt.dz.egobus.servicemanager.entities.DriverRegisterBusRelative;

import java.util.ArrayList;
import java.util.List;

/**
 * @param
 * @author Anson
 * @date 17-3-27
 * @name 车辆状态bean
 * @since 1.0.3
 */
public class DriverStatus implements BaseBean {

    private static final long serialVersionUID = -9175357220363168686L;
    private Integer status;

    private String cacheKey;

    private String businessId;

    /**
     * 预约的日期yyyy-MM-dd
     */
    private List<String> bespeaks = new ArrayList<>();

    /**
     * @param json DriverStatus 的字符串
     * @author Anson
     * @date 17-3-23
     * @name 将json字符串转换为bean
     * @since 1.0.2
     */
    public static DriverStatus toBean(String json) {
        return JSON.parseObject(json, DriverStatus.class);
    }


    /**
     * @author Anson
     * @date 17-3-23
     * @name 获取当前json值
     * @since 1.0.2
     */
    public String toJson() {
        return JSON.toJSONString(this);
    }


    public void setStatus(DriverRegisterBusRelative.RelativeStatus status) {
        this.setStatus(status.getCode());
    }

    public DriverStatus() {
    }


    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getCacheKey() {
        return cacheKey;
    }

    public void setCacheKey(String cacheKey) {
        this.cacheKey = cacheKey;
    }

    public String getBusinessId() {
        return businessId;
    }

    public void setBusinessId(String businessId) {
        this.businessId = businessId;
    }

    public List<String> getBespeaks() {
        return bespeaks;
    }

    public void setBespeaks(List<String> bespeaks) {
        this.bespeaks = bespeaks;
    }

    @Override
    public String toString() {
        return "DriverStatus{" +
                "status=" + status +
                ", cacheKey='" + cacheKey + '\'' +
                ", businessId='" + businessId + '\'' +
                ", bespeaks=" + ArrayUtils.toArray(bespeaks.toArray()) +
                '}';
    }
}
